import request from '@/utils/request'
import mock from './mock/exchange'

// 是否开启mock
const isMock = process.env.NODE_ENV === 'development'

// 获取汇率信息
// export function getExchangeRates() {
//   if (isMock) {
//     return Promise.resolve(mock['get|/api/exchange/rates'])
//   }
//   return request({
//     url: '/exchange/rates',
//     method: 'get'
//   })
// }

// 查询贡献的统计
export function getFinance() {
  return request({
    url: '/exchange/finance',
    method: 'get'
  })
}

// 获取兑换记录
export function getExchangeRecords(data) {
  return request({
    url: '/exchange/tradeList',
    method: 'get',
    params: data
  })
}

// 提交兑换请求
export function submitExchange(data) {
  return request({
    url: '/exchange/trade',
    method: 'post',
    data
  })
}